package no.ntnu.fp.views;

import javax.swing.JOptionPane;

public abstract class AbstractView {
	protected static int showChoices(String[] choices, String message, String title) {
		boolean empty = false;
		if (choices.length == 0) {
			String[] newChoices = {"Tilbake"};
			choices = newChoices;
			empty = true;
		}
		
		int input = JOptionPane.showOptionDialog(
				null, message, title            
				, JOptionPane.YES_NO_OPTION 
				, JOptionPane.PLAIN_MESSAGE
				, null, choices, "Avtale"
				);
		
		if (empty) {
			return -1;
		}
		return input;
	}
	

}
